package com.huyanqi.front.rest.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.huyanqi.core.RetdCodeType;
import com.huyanqi.core.RetdObj;
import com.huyanqi.core.service.impl.BaseFrontServiceImpl;
import com.huyanqi.dao.SignDAO;
import com.huyanqi.entity.Share;
import com.huyanqi.entity.Sign;
import com.huyanqi.front.rest.service.SignRestService;

@Service("SignRestService")
public class SignRestImpl extends BaseFrontServiceImpl<Sign,Long, SignDAO> implements SignRestService{

	@Override
	@Resource(name="SignDAO")
	public void setEntityDao(SignDAO entityDao) {
		this.entityDao=entityDao;
	}

	@Override
	public RetdObj<List<Sign>> findMySign(Long uid) {
		RetdObj<List<Sign>> retd = new RetdObj<List<Sign>>();
		List<Sign> list = entityDao.executeQuery("SELECT new Sign(s.siId,s.siUser,s.siShop,s.siTime,s.siWeather,s.siMood,u.uHead) FROM Sign s,User u WHERE s.siUser = ? GROUP BY s.siId ORDER BY s.siTime DESC", uid);
		if(list!=null){
			retd.setRealObj(list);
			retd.setCode(RetdCodeType.PASS_OK);
		}else{
			retd.setCode(RetdCodeType.PASS_NODATA);
		}
		return retd;
	}
	
}
